package com.example.controller;


import java.util.List;

import com.example.entity.Epp;
import com.example.service.EppService;
import com.example.service.impl.EppServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EppController {

    private EppService eppService = new EppServiceImpl();

    @GetMapping("/epp/{id}")
    public Epp listEpp(@PathVariable int id) throws JsonProcessingException{
        
        System.out.println("获得用户,编号 : "+id);
        Epp epp = eppService.getById(id);

        return epp;
    }
    @GetMapping("/epp")
    public List<Epp> listEpp(String keyWord) throws JsonProcessingException{
        
        System.out.println("获得前端参数keyword : " + keyWord);
        List<Epp> epps = eppService.listByKeyword("%"+keyWord+"%");

        return epps;
    }
}
